package com.smart.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.smart.pojo.ConceptualProduct;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.smart.resp.ConceptualResp;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author lyj
 * @since 2023-05-11
 */
public interface ConceptualProductMapper extends BaseMapper<ConceptualProduct> {

    @Select("select cp.*,u.username username\n" +
            "from conceptual_product cp\n" +
            "left join user u\n" +
            "on cp.user_id=u.id ${ew.customSqlSegment}")
    Page<ConceptualResp> queryByCondition(@Param("ew") QueryWrapper<ConceptualResp> wrapper, Page<ConceptualResp> page);


    @Select("select cp.*,u.username username\n" +
            "from conceptual_product cp\n" +
            "left join user u\n" +
            "on cp.user_id=u.id\n" +
            "where u.del_flag=0\n" +
            "and cp.del_flag=0\n" +
            "and cp.id=#{billId}")
    ConceptualResp queryByBillId(long billId);
}
